#if !defined(AFX_COMMANDLISTBOX_H__A137FFE7_8F62_444D_85FC_6204D7FDA910__INCLUDED_)
#define AFX_COMMANDLISTBOX_H__A137FFE7_8F62_444D_85FC_6204D7FDA910__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CommandListBox.h : header file
//

#include <afxtempl.h>

/////////////////////////////////////////////////////////////////////////////
// CCommandListBox window

typedef struct tagVSCommand
{
	WORD wID;
	WORD wGroupID;
	BYTE bUnidentified[2];
	WORD wImageIndex;
	WORD cbExtra;
	LPBYTE pbExtra;
	LPTSTR pszID;
	LPTSTR pszMenu;
	LPTSTR pszLongDescription;
	LPTSTR pszShortDescription;
} VSCOMMAND, *LPVSCOMMAND;

class CCommandListBox : public CListBox
{
// Attributes
public:

	// CAT_FILE,	CAT_EDIT,
	// CAT_VIEW,	CAT_WIZARDBAR,
	// CAT_INSERT,	CAT_PROJECT,
	// CAT_BUILD,	CAT_DEBUG,
	// CAT_IMAGE,	CAT_LAYOUT,
	// CAT_QUERY,	CAT_DIAGRAM,
	// CAT_TOOLS,	CAT_WINDOW,
	// CAT_HELP,	CAT_MACROS,
	// CAT_ADDINS,	CAT_ALL
	enum CATEGORIES
	{
		CAT_FILE	= 0,
		CAT_EDIT,
		CAT_VIEW,
		CAT_WIZARDBAR,
		CAT_INSERT,
		CAT_PROJECT,
		CAT_BUILD,
		CAT_DEBUG,
		CAT_IMAGE,
		CAT_LAYOUT,
		CAT_QUERY,
		CAT_DIAGRAM,
		CAT_TOOLS,
		CAT_WINDOW,
		CAT_HELP,
		CAT_MACROS,
		CAT_ADDINS,
		CAT_ALL,
	};

// Operations
public:
	int ExtractCommandsFromResource(const BYTE * lpbBuffer, DWORD dwResourceSize);
	void RemoveAll();
	int Reload(CCommandListBox::CATEGORIES cat = CCommandListBox::CAT_ALL);
	const LPVSCOMMAND GetCommand(int nIndex);
	int FindCommand(const WORD wID);
	int FindCommand(LPCTSTR pszID);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCommandListBox)
	//}}AFX_VIRTUAL

// Implementation
protected:
	int AddCommand(const LPVSCOMMAND pCommand);
	BOOL IsCommandInCategory(LPVSCOMMAND pCommand, CCommandListBox::CATEGORIES cat);

	// Generated message map functions
protected:
	//{{AFX_MSG(CCommandListBox)
	afx_msg void OnDestroy();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

private:
	CMap<WORD, WORD, LPVSCOMMAND, LPVSCOMMAND>m_commandMap;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_COMMANDLISTBOX_H__A137FFE7_8F62_444D_85FC_6204D7FDA910__INCLUDED_)
